﻿package mortal.game.view.common.alertwins
{
    import com.mui.controls.*;
    import extend.language.*;
    import flash.display.*;
    import flash.events.*;
    import mortal.common.*;
    import mortal.component.window.*;

    public class CustomAlertWin extends GAlertWin
    {

        public function CustomAlertWin(param1:Number, param2:Number)
        {
            super(param1, param2);
            return;
        }// end function

        override protected function get myWidth() : Number
        {
            var _loc_1:int = 0;
            if (w == -1)
            {
                _loc_1 = boarderWidth * 2;
                w = Math.max(title.width + _loc_1, message.width + _loc_1 + 10, btnSp.width + _loc_1, minWidth);
                if (w < minWidth)
                {
                    w = minWidth;
                }
            }
            return w;
        }// end function

        override protected function get myHeight() : Number
        {
            if (h == -1)
            {
                h = 60 + message.height + Alert.buttonHeight + 45;
                if (h < minHeight)
                {
                    h = minHeight;
                }
            }
            return h;
        }// end function

        override protected function setTitle() : void
        {
            if (Alert.title is String)
            {
                (boarder as BaseWindow).title = Alert.title;
            }
            else if (!Alert.title)
            {
                Alert.title = Language.getString(20712);
                (boarder as BaseWindow).title = Alert.title;
            }
            else
            {
                title = Alert.title;
            }
            return;
        }// end function

        override protected function layoutMessage() : void
        {
            message.x = 20 + this.myWidth / 2 - message.width / 2;
            message.y = 55;
            return;
        }// end function

        override protected function layoutBtnSp() : void
        {
            btnSp.x = 12 + (this.myWidth - (Alert.buttonWidth + Alert.buttonGap) * allButtons.length + Alert.buttonGap) / 2;
            btnSp.y = this.myHeight - 27;
            return;
        }// end function

        override protected function layoutTitle() : void
        {
            title.y = 3;
            title.x = (this.myWidth - title.width) / 2;
            return;
        }// end function

        override protected function layoutAllUI() : void
        {
            super.layoutAllUI();
            var _loc_1:* = getButtonFlagsList();
            if (_loc_1[3] == 1)
            {
            }
            if (boarder is BaseWindow)
            {
                (boarder as BaseWindow).title = Alert.title;
            }
            prompt.addEventListener(WindowEvent.CLOSE, this.Close_Handler, false, 0, true);
            return;
        }// end function

        override protected function createPromptBoarder() : Sprite
        {
            var _loc_1:* = new CutomAlertWinWindow();
            (_loc_1 as CutomAlertWinWindow).isForbidenDrag = true;
            (_loc_1 as CutomAlertWinWindow).closeBtn.visible = false;
            return _loc_1;
        }// end function

        private function Close_Handler(event:Event) : void
        {
            DisplayUtil.removeMe(this);
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            return;
        }// end function

    }
}
